<template>
  <div class="login-main-wrap">
    <div class="form">
      <e-input
        placeholder="请输入用户名"
        v-model="ruleForm.un"
        autocomplete="off"
        clearable
      ></e-input>
      <el-button type="primary" @click="login_fn">登录</el-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ruleForm: {
        un: "",
      },
    };
  },
  components: {
    EInput: () => import("../../components/EInput.vue"),
  },
  methods: {
    login_fn() {
      let un = this.ruleForm.un.trim();
      if (un) {
        if (un !== null) {
          this.setItem("un", un);
          this.$router.go(-1);
          this.$message.success("登录成功！");
        }
      }
    },
  },
};
</script>

<style lang="less" scoped>
.login-main-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}
.form {
  width: 300px;
  height: 140px;
  border-radius: 10px;
  border: 1px solid #ccc;
  padding: 20px;
  text-align: right;
  .el-button {
    margin-top: 20px;
  }
}
</style>